{% extends "base.html" %}

{% block title %}Features{% endblock %}
{% block content_title %}{{ collection.title }}{% endblock %}

{% block content %}
<article class="prose">
<a href="collections/{{collection.id}}/items.json">JSON</a><br/>
</article>

<table class="table table-zebra table-xs">
  <thead>
    <tr>
    {% if features.features %}
      {% set first_feature = features.features | first %}
      <th>id</th>
      {% for prop in first_feature.properties %}
      <th>{{prop}}</th>
      {% endfor %}
    {% endif %}
    </tr>
  </thead>
  <tbody>
  {% for feature in features.features %}
    <tr>
      <td><a href="collections/{{collection.id}}/items/{{ feature.id }}">{{ feature.id }}</a></td>
      {% for prop in first_feature.properties %}
      <td>{{feature.properties[prop]}}</td>
      {% endfor %}
    </tr>
  {% endfor %}
  </tbody>
</table>

<ul class="menu menu-horizontal bg-base-200">
  <li class="menu-title">Links</li>
  {% for link in features.links %}
  <li><a href="{{ link.href }}">{{ link.title }}</a> [{{link.rel}}] ({{link.type}})</li>
  {% endfor %}
</ul>

{% endblock %}
